<?php
/**
 * Created by PhpStorm.
 * User: sunku
 * Date: 2017/12/26
 * Time: 16:37
 */

namespace Admin\Logic;
use Think\Model;

class QuotedLogic extends Model
{
    protected $trueTableName = 'wz_quoted';
    /**
     * @param $params
     * @return string
     */
    public function saveQuoted($params){
        $id = isset($params['id'])?intval($params['id']):'';
        if(!$id){
            $result = D('Resource/Quoted','Service')->addQuoted($params);
        }else{
            $result = D('Resource/Quoted','Service')->updateQuotedInfo($params);
        }

        if(!$result){
            return Response(2001,"操作失败");
        }
        return Response(999,"操作成功");
    }

    /**
     * @param $params
     * @return mixed
     */
    public function searchQuotedList($params) {
        $result = D('Resource/Quoted', 'Service')->searchQuotedList($params);
        return $result;
    }

    /**
     * @param $params
     * @return mixed
     */
    public function getQuotedInfo($params){
        $result = D('Resource/Quoted','Service')->getQuotedInfo($params);
        return $result;
    }

    /**
     * @param $params
     * @return mixed
     */
    public function addQuoted($params){
        $result = D('Resource/Quoted','Service')->addQuoted($params);
        return $result;
    }
    /**
     * @param $params
     * @return mixed
     */
    public function deleteQuoted($params){
        if(empty($params)){
            return Response(2001,"无效的操作");
        }
        $result = D('Resource/Quoted','Service')->deleteQuoted($params);
        if(!$result){
            return Response(2002,"操作失败");
        }
        return Response(999,"操作成功");
    }
}